/**
 * Copyright 2011 Poltman.Ltd; www.poltman.com. All rights reserved.		
 *
 * This file is part of the dspace-poltman project http://www.poltman.com.
 *
 * This is free software; you can redistribute it and/or modify it under
 * the terms of DuraSpace DSpace license detailed in the LICENSE and NOTICE 
 * files at the root of the source tree and available online at
 * http://www.dspace.org/license/
 * 
 */
package com.poltman.dscentral.extended.services.impl;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.poltman.dscentral.db.entity.pm.MainMenuGroupsEntity;
import com.poltman.dscentral.db.repository.pm.MainMenuGroupsRepository;
import com.poltman.dscentral.extended.services.MainMenuGroupsServiceFacade;

/**
 * 
 * @author Zbigniew Ciok; z.ciok@poltman.com
 * @version $Revision: 1670 $
 *
 */
@Service("mainMenuGroupsServiceFacade")
public class MainMenuGroupsServiceFacadeImpl implements MainMenuGroupsServiceFacade {
	
	private static Logger log = Logger.getLogger(MainMenuGroupsServiceFacadeImpl.class);
	
	private final MainMenuGroupsRepository mainMenuGroupsRepository;
	
	@Autowired
	public MainMenuGroupsServiceFacadeImpl(MainMenuGroupsRepository mainMenuGroupsRepository) {
		this.mainMenuGroupsRepository = mainMenuGroupsRepository;
	}
	
	@Transactional(rollbackFor=Exception.class)
	@Override
	public void addMainMenuGroup(List<MainMenuGroupsEntity> mainMenuGroup)  throws Exception {
		for (MainMenuGroupsEntity menuItem : mainMenuGroup) {
			mainMenuGroupsRepository.save(menuItem);
		}		
	}
}
